#!/bin/bash

ETCDCTL_API=3
ETCD_CACERT="{{ ca_dir }}/ca.pem"
ETCD_CERT="{{ ca_dir }}/etcd.pem"
ETCD_KEY="{{ ca_dir }}/etcd-key.pem"
ETCD_ENDPOINTS="{{ ETCD_NODES_POINTS }}"

echo "=== ETCD Endpoint Status ==="
{{ bin_dir }}/etcdctl \
  --cacert="$ETCD_CACERT" \
  --cert="$ETCD_CERT" \
  --key="$ETCD_KEY" \
  --endpoints="$ETCD_ENDPOINTS" \
  -w table \
  endpoint status

echo ""
echo "=== ETCD Endpoint Health ==="
{{ bin_dir }}/etcdctl \
  --cacert="$ETCD_CACERT" \
  --cert="$ETCD_CERT" \
  --key="$ETCD_KEY" \
  --endpoints="$ETCD_ENDPOINTS" \
  -w table \
  endpoint health
